<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Title</title>
    <script src="js/vue@3.3.4.global.js"></script>

</head>
<body>
<!--只要是视图中要使用的变量，都必须在data模型中声明-->
    <div id="app">
        <h3>{{username}}</h3>
    </div>
</body>
<script>
    const app = Vue.createApp({
        data(){
            return {
                username: 'admin'
            }
        },
        beforeCreate(){
            console.log("--------beforeCreate-----------")
            console.log("username:",this.username)
        },
        created(){
            console.log("--------created-----------")
            console.log("username:",this.username)
        },
        beforeMount(){
            //动画效果，等待数据展示
            console.log("--------onBeforeMount-----------")
            console.log("username:",this.username)
            this.username ="jack";
        },
        mounted(){
            //异步请求远程数据
            console.log("--------onMounted-----------")
            console.log("username:",this.username)
        }
    })
    app.mount('#app')
</script>

</html>